﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Driven.ProcessScheduler.Web.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Process Scheduler - Manager";

            return View();
        }

        public ActionResult Admin()
        {
            return View();
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Admin(string schedulerLocation)
        {
            if (Directory.Exists(schedulerLocation))
            {
                ViewData["Message"] = "Saved";
            }
            else
            {
                ViewData["Message"] = string.Format("Location: '{0}' does not exist.", schedulerLocation);
                ModelState.AddModelError("_FORM", "TESTING TESTIN TESTING");
            }

            return View();
        }
    }
}
